import java.util.*;
public class _05{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();
        int dp[][] = new int[n][n];
        for (int i = 0; i <n; i++) {
            for (int j = 0; j <n; j++) {
                dp[i][j] = sc.nextInt();
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if(i==0&&j>0){ 
                    dp[i][j]=dp[i][j]+dp[i][j-1];
                }
                else if(j==0&&i>0){ 
                    dp[i][j]=dp[i][j]+dp[i-1][j];
                }
                else if(i>0){ 
                    dp[i][j]=dp[i][j]+Math.max(dp[i-1][j],dp[i][j-1]);
                }
            }
        }
        System.out.println(dp[n-1][n-1]);
}
}